﻿@{
    ViewBag.Title = "";
}
@using CMS.Common.Helpers
@model List<CMSApplication.Areas.Administration.Models.CustomerTypeModel>

<script>
    jQuery(document).ready(function ($) {
        $("a.delete").click(function () {
            var $this = $(this);
            var item_id = $this.closest('tr').find('.Spanid').html();
            if (confirm("Bạn chắc chắn muốn xóa loại khách hàng: Mã = " + item_id + "?")) {
                $.get("/CustomerType/Delete?id=" + item_id, function () {
                    $.get("/CustomerType/ListSlide", function (data) {
                        $(".list").html("");
                        $(".list").html(data);
                    });
                });
            }
        });
    });
</script>
@if (Model.Count() > 0)
{
    <table class="table" style="width:100%">
        <thead>
            <th>Mã</th>
            <th>Tên</th>
            <th>Mô tả</th>
            <th width="80px">Tác vụ</th>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        <span class="Spanid">@item.Id</span>
                    </td>
                    <td>
                        <span class="spanName">@item.Name</span>
                    </td>
                    <td>
                        <span>@item.Desc</span>
                    </td>
                    <td>
                        <a title="Di chuyển lên » @item.Id" class="icon-chevron-up" href="/CustomerType/Move?gallery_id=@item.Id&direction=0"></a>
                        <a title="Di chuyển xuống » @item.Id" class="icon-chevron-down" href="/CustomerType/Move?gallery_id=@item.Id&direction=1"></a>
                        <a title="Chỉnh sửa » @item.Id" href="@Url.Action("Edit", "CustomerType", new { id = item.Id })" class="icon-pencil"></a>
                        <a title="Xóa bỏ » @item.Id" href="javascript:void(0)" class="icon-trash delete"></a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
}
else
{
    <h2>Không có dữ liệu.</h2>
}
